# this script enable the vs10 Kernel32.EncodePointer and Kernel32.DecodePointer
# dependence that makes the final generated executables not working on 2000 to XPSP2-
# the project that hope to enable this support must add the VSPORT_ADDI_SRCS to it's project
# we use cmake's custom ability to do the magic because cmake's ASM_MASM mode is not
# functioning yet
if(NOT __VS10PORT__)
  set(__VS10PORT__ TRUE)
  set(VSPORT_ADDI_SRCS )
  if((MSVC AND MSVC_VERSION GREATER 1599) AND (NOT CMAKE_CL_64)) # only for vs2010 32 bit target
    set(VSPORT_ADDI_SRCS vs10port.obj)
    file(TO_NATIVE_PATH "${CMAKE_CURRENT_LIST_DIR}/../winports/vsports/vs10port.asm" VSPORT_ASM_FILE) # MASM can't deal with cmake style path
    add_custom_command(OUTPUT vs10port.obj
                       COMMAND ml /c ${VSPORT_ASM_FILE}
		       VERBATIM
      )
    #message(STATUS "${VSPORT_ASM_FILE}")
    set_source_files_properties(${VSPORT_ADDI_SRCS} PROPERTIES EXTERNAL_OBJECT TRUE)
  endif()
endif()

